<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="clock.css"/>
	</head>
	<body>
		<div class="bg">
			<div class="clock">
				<div class="hour" id='h'></div>
				<div class="min" id='m'></div>
				<div class="sec" id='s'>
					<div class="black"></div>
					<div class="red"></div>
				</div>
			</div>
		</div>
		 <script>
		 	
		 	    var hh = document.getElementById('h');
		 		var mm = document.getElementById('m');
		 		var ss = document.getElementById('s');
		 	function clock(){
		 		var date =  new Date();
		 		var ms = date.getMilliseconds();
		 		//秒数
		 		var s = date.getSeconds() + ms/1000;
		 		ss.style.transform = 'rotate('+ s*6 +'deg)';
		 		//分钟，60分钟转360度，一分钟转6度
		 		var m = date.getMinutes() +s/60;
		 		mm.style.transform = 'rotate('+ m*6 +'deg)';
		 		//小时，12个小时转360度，1小时转30度
		 		var h = date.getHour() + m/60;
		 		hh.style.transform = 'rotate(' + h*30 +'deg)';
		 	}
		 	
		 setInterval(clock,1000);
		 </script>
	</body>
</html>
